<%@ taglib uri="/WEB-INF/bpmapp.tld" prefix="ssp" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<%@ page import="com.broadvision.portal.services.PortalVisitor" %>
<%@ page import="com.broadvision.web.servlet.SessionVisitor" %>
<%@ page import="com.broadvision.data.common.TableData" %>
<%@ page import="com.broadvision.data.common.RowData" %>

<!-- Collaboration bookmarks block -->
<table width="100%" class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="Collaboration space bookmarks">
  <tr class="listHeader"> 
    <th align="left"><bean:message bundle="appCommonRes" key="cs.bookmark.name" /></th>
    <th align="left"><bean:message bundle="appCommonRes" key="cs.status" /></th>
    <th align="left"><bean:message bundle="appCommonRes" key="cs.create.date" /></th>
    <th align="left"><bean:message bundle="appCommonRes" key="cs.complete.date" /></th>
  </tr>
  <ssp:retrieveCsBookmark id="csBookmarkList" toScope="page">
     5
  </ssp:retrieveCsBookmark>
  
  <bean:size id="csBookmarkListSize" name="csBookmarkList" />
  
  <logic:equal name="csBookmarkListSize" value="0">
    <tr class="listOdd">
      <td colspan="4" align="center">
        <bean:message bundle="appCommonRes" key="cs.bookmark.no" />      
      </td>
    </tr>  
  </logic:equal>
  
  <logic:iterate id="oneItem" name="csBookmarkList" scope="page" indexId="index">
    <tr class="<%=index.intValue() % 2 == 0 ? "listEven" : "listOdd"%>">
      <td>
        <html:link page="/cs/micrositeHome.do" paramId="micrositeId" 
               paramName="oneItem" paramProperty="micrositeId">
          <bean:write name="oneItem" property = "bookmarkName"  />
        </html:link>
      </td>
      <td>
        <logic:empty name="oneItem" property="csCloseTime">
          <bean:message bundle="appCommonRes" key="cs.status.active" />
        </logic:empty>
        <logic:notEmpty name="oneItem" property="csCloseTime">
          <bean:message bundle="appCommonRes" key="cs.status.completed" />
        </logic:notEmpty>
      </td>
      <td>
        <bean:write bundle="appCommonRes" name="oneItem" property ="creationTime" formatKey="format.datetime.short"/>
      </td>
      <td>
        <bean:write bundle="appCommonRes" name="oneItem" property ="csCloseTime" formatKey="format.datetime.short"/>
      </td>
    </tr>
  </logic:iterate>
  <logic:notEmpty name="csBookmarkList">
    <tr>
      <td colspan="4">
        <br>
        <%
          SessionVisitor sessionVisitor = SessionVisitor.getInstance(session);
          TableData csBookmarkTable =
               sessionVisitor.getPortalVisitor().getVisitor().getListData(PortalVisitor.BV_EP_UPROF_CS_BK);
          int totalNo = (csBookmarkTable == null) ? 0 : csBookmarkTable.size();
          int totalBokmarkNoInService = 0;
          for (int i = 0; i < totalNo; i++) {
            RowData row = csBookmarkTable.getRow(i);
            if (row.getIntValue("SERVICE_ID") == sessionVisitor.getServiceId()) {
              totalBokmarkNoInService++;
            }
          }          
          int displayedNo = ((Integer)pageContext.getAttribute("csBookmarkListSize")).intValue();
          if (displayedNo < totalBokmarkNoInService) {
        %>
            <bean:message bundle="appCommonRes" key="show.no.of.all" arg0="<%=String.valueOf(csBookmarkListSize)%>" arg1="<%=String.valueOf(totalBokmarkNoInService)%>"/>
            &nbsp;&nbsp;
        <%}%>
        <html:link page="/csBookmarkList.do">
          <bean:message bundle="appCommonRes" key="view.full.details" />
        </html:link>
      </td>
    </tr>
  </logic:notEmpty>
</table>
<!-- End collaboration bookmarks block -->


